<?php

/**
 * EmailMessageReply form base class.
 *
 * @method EmailMessageReply getObject() Returns the current form's model object
 *
 * @package    ecollegeplus
 * @subpackage form
 * @author     Batanayi Matuku
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseEmailMessageReplyForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'sender_id'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SendingUser'), 'add_empty' => false)),
      'responder_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RespondingUser'), 'add_empty' => false)),
      'email_message_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('EmailMessage'), 'add_empty' => false)),
      'email_message_reply_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('EmailMessageReply'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'sender_id'              => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SendingUser'))),
      'responder_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('RespondingUser'))),
      'email_message_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('EmailMessage'))),
      'email_message_reply_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('EmailMessageReply'))),
    ));

    $this->widgetSchema->setNameFormat('email_message_reply[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'EmailMessageReply';
  }

}
